SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwlAlumnos
AS
SELECT    dbo.tb_Alumnos.idAlumno AS id, dbo.vwrTiposDeDocumento.Descripcion AS TipoDoc, dbo.tb_Alumnos.Documento, dbo.tb_Alumnos.Apellidos, 
                      dbo.tb_Alumnos.Nombres, dbo.vwrSexo.Descripcion AS Sexo, dbo.vwrLocalidades.Descripcion AS Localidad, dbo.tb_Alumnos.Cuise, 
                      dbo.tb_Alumnos.DocRepresentanteBecas, dbo.tb_Alumnos.NombreRepresentanteBecas
FROM         dbo.tb_Alumnos INNER JOIN
                      dbo.vwrLocalidades ON dbo.tb_Alumnos.Localidad = dbo.vwrLocalidades.ID INNER JOIN
                      dbo.vwrSexo ON dbo.tb_Alumnos.Sexo = dbo.vwrSexo.ID INNER JOIN
                      dbo.vwrTiposDeDocumento ON dbo.tb_Alumnos.Tipo = dbo.vwrTiposDeDocumento.ID


GO
GRANT SELECT ON  [dbo].[vwlAlumnos] TO [Alumnos]
GRANT SELECT ON  [dbo].[vwlAlumnos] TO [Becas]
GRANT SELECT ON  [dbo].[vwlAlumnos] TO [Coordinaciones]
GRANT SELECT ON  [dbo].[vwlAlumnos] TO [GestionInstitucional]
GRANT SELECT ON  [dbo].[vwlAlumnos] TO [SoloVer]
GO
